<!DOCTYPE html>

<html>

<head>
    <meta charset="UTF-8" />
    <title>组件的几个注意点</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>

    <!--准备好一个容器-->

    <div id="root">
        <school></school>
    </div>

    <script type="text/javascript">
        Vue.config.productionTip = false


        const school = {
                template: `
            <div>
                <h2>学校名称：{{schoolName}}</h2>
                <h2>学校地址：{{schoolAddress}}</h2>

            </div>
            `,
                data() {
                    return {
                        schoolName: "xjtu",
                        schoolAddress: "西安"
                    }
                }
            }

        //组件初始化
        const sch = Vue.extend({
            template:`
            <div>
                <h2>学校名称：{{schoolName}}</h2>
                <h2>学校地址：{{schoolAddress}}</h2>

            </div>
            `,
            data(){
                return {
                    schoolName:"xjtu",
                    schoolAddress:"西安"
                }
            }
        })

        //局部注册
        new Vue({
            el:"#root",
            components:{
                school:sch
            }
        })


    </script>
</body>


</html>